﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Practices.Unity;
using Skynet.BusinessLogic.BusinessComponents;
using Infrastructure.Services.ServiceProxies;
using Skynet.BusinessEntities;
using System.ServiceModel;
using Skynet.ServiceLayer.External.Test;

namespace Skynet.ServiceLayer.Internal.Test
{
    [TestClass]
    public class BCExamTest
    {        
        [ClassInitialize()]
        public static void MyClassInitialize(TestContext testContext)
        {
            UnityHelper.ConfigurateContainer();
        }
        [TestMethod]
        public void BCExamsSearchExternalOperations()
        {
            
            var container = Infrastructure.Aspect.Patterns.Singleton<UnityContainer, IUnityContainer>.Instance;
            var bcexams = container.Resolve<IBCExamQueries>();                            
            var target = bcexams as ClientBase<IBCExamQueries> ;
            if (target != null)
            {
                target.ClientCredentials.UserName.UserName = "Developer";
                target.ClientCredentials.UserName.Password = "Pa$$w0rd";
            }
            
            var results = bcexams.SearchExamCategories(options: SearchExamCategoriesOptions.GetAll);    
            
        }
        [TestMethod]
        public void BCExamsQueryExternalOperations()
        {            
            var container = Infrastructure.Aspect.Patterns.Singleton<UnityContainer, IUnityContainer>.Instance;
            var bcexams = container.Resolve<IBCExamQueries>();                
            var results = bcexams.QueryExamCategories(QueryExamCategoriesOptions.GetAllView);         
        }

        [TestMethod]
        public void BCExamsExternalCUDOperations()
        {
            var container = Infrastructure.Aspect.Patterns.Singleton<UnityContainer, IUnityContainer>.Instance;
            var bcexams = container.Resolve<IBCExams>();                
            var item = new List<ExamCategory>();
            for (int i = 0; i < 100; i++)
            {
                item.Add(new ExamCategory() { Id = Guid.NewGuid(), Title = "test", Description = "test" });    
            }            
            bcexams.MaintenanceExamCategories(item);            
        }        
    }
}
